﻿namespace PLC.PLCAlarm
{
    /// <summary>
    /// 从文件读取的PLC报警信息
    /// </summary>
    public class AlarmFileData
    {
        /// <summary>
        /// alarmData有5个元素，分别对应字，位，报警触发值，报警代码，报警信息
        /// </summary>
        /// <param name="alarmData"></param>
        public AlarmFileData(string[] alarmData)
        {
            Word = int.Parse(alarmData[0]);
            Bit = int.Parse(alarmData[1]);
            AlarmTriger = alarmData[2] == "1";
            AlarmCode = alarmData[3];
            AlarmInfo = alarmData[4];
        }

        /// <summary>
        /// 报警字地址
        /// </summary>
        public int Word { get; set; }
        /// <summary>
        /// 报警位地址
        /// </summary>
        public int Bit { get; set; }
        /// <summary>
        /// 报警触发值
        /// （为true的话就是当读取值是true的时候触发这个报警）
        /// </summary>
        public bool AlarmTriger { get; set; }
        /// <summary>
        /// 要上传到mes的报警代码
        /// </summary>
        public string AlarmCode { get; set; }
        /// <summary>
        /// 报警说明
        /// </summary>
        public string AlarmInfo { get; set; }

    }
}
